/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GUIMain.java
 *
 * Created on Oct 12, 2011, 6:30:33 PM
 */
package gui;

import Config.Localization;
import entities.LoanType;
import entities.User;
import java.awt.Button;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import javax.swing.Timer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import sun.net.www.content.image.png;

/**
 *
 * @author Bich Tran Van
 */
public class GUIMain extends javax.swing.JFrame {

    private Timer time ;
    private User user;
    private GUIMyInfo guiMyInfo;
    private GUIBranch guiBranch;
    private GUILoanType guiLoanType;
    private GUIFineLoan guiFineLoan;
    private GUIUser guiUser;
    private GUILoanContact guiLoanContact;
    private GUICustomer guiCustomer;
    private GUIHome guiHome;
    
    /** Creates new form GUIMain */
    public GUIMain(User user){
        try {
            this.user = user;
            //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            UIManager.setLookAndFeel(ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel());
            SwingUtilities.updateComponentTreeUI(this);
            Image img = new ImageIcon(getClass().getResource("/icon/logo.png")).getImage();
            setIconImage(img);
            initComponents();
            authorization();
        } /*catch (ClassNotFoundException ex) {
            Logger.getLogger(GUIMain.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(GUIMain.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(GUIMain.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(GUIMain.class.getName()).log(Level.SEVERE, null, ex);
        }
           *
           */
        catch(Exception e){
        
        }
         
        
        setLocationRelativeTo(null);
        initGUIs();
        callJPanel(guiHome, "Welcome");
        lblName.setText(user.getFullName());
        lblPosition.setText(user.getUserType().getTypeName());
        lblBranch.setText(user.getBranchId().getBranchName());
    }

    public GUIMain() {
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
           //SwingUtilities.updateComponentTreeUI(this);
           //  UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
            SwingUtilities.updateComponentTreeUI(this);
            Image img = new ImageIcon(getClass().getResource("/icon/1318495246_money_bag.png")).getImage();
            setIconImage(img);
            initComponents();
            
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(GUIMain.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(GUIMain.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(GUIMain.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(GUIMain.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }
    
    public void initGUIs(){
        setGuiMyInfo(new GUIMyInfo(user));
        setGuiLoanContact(new GUILoanContact(user));
        guiUser = new GUIUser();
        guiBranch = new GUIBranch();
        guiFineLoan = new GUIFineLoan();
        guiLoanType = new GUILoanType();
        setGuiCustomer(new GUICustomer(user));
        setGuiHome(new GUIHome(user,this));
    }
    
    public void authorization(){
        if(user.getUserType().getTypeId() == 1){
            
        }
        if(user.getUserType().getTypeId() == 2){
            btnBranch.setVisible(false);
            btnFineLoan.setVisible(false);
            btnLoanType.setVisible(false);
            btnUser.setVisible(false);
            btnReport.setVisible(false);
        }
        if(user.getUserType().getTypeId() == 3){
            btnBranch.setVisible(false);
            btnFineLoan.setVisible(false);
            btnLoanType.setVisible(false);
            btnUser.setVisible(false);
            btnReport.setVisible(false);
        }
    }
    public void callJPanel(JPanel jpanel , String name)
    {
        /*jplMain.removeAll();
        jpanel.setVisible(false);
        jplMain.add(jpanel, new AbsoluteConstraints(0,0,jplMain.getWidth(),jplMain.getHeight()));
        jpanel.setVisible(true);
         * 
         */
        pnlMain.removeAll();
        jpanel.setVisible(false);
        //pnlMain.add(jpanel, new AbsoluteConstraints(0,0,pnlMain.getWidth(),pnlMain.getHeight()));
        pnlMain.add(name, jpanel);
        jpanel.setVisible(true);
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlHeader = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        pnlLeftContent = new javax.swing.JPanel();
        jtbMenu = new javax.swing.JToolBar();
        btnHome = new javax.swing.JButton();
        btnBranch = new javax.swing.JButton();
        btnLoanType = new javax.swing.JButton();
        btnFineLoan = new javax.swing.JButton();
        btnUser = new javax.swing.JButton();
        btnCustomer = new javax.swing.JButton();
        btnLoan = new javax.swing.JButton();
        btnReport = new javax.swing.JButton();
        btnMyAccount = new javax.swing.JButton();
        lblTime = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        btnExit = new javax.swing.JButton();
        btnLogOut = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        lblName = new javax.swing.JLabel();
        lblPosition = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        lblBranch = new javax.swing.JLabel();
        pnlMain = new javax.swing.JTabbedPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Loan Processing System");
        setBackground(new java.awt.Color(204, 102, 0));
        setMinimumSize(new java.awt.Dimension(1054, 693));
        setResizable(false);

        pnlHeader.setBackground(new java.awt.Color(255, 255, 255));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/banner.png"))); // NOI18N

        javax.swing.GroupLayout pnlHeaderLayout = new javax.swing.GroupLayout(pnlHeader);
        pnlHeader.setLayout(pnlHeaderLayout);
        pnlHeaderLayout.setHorizontalGroup(
            pnlHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 1054, Short.MAX_VALUE)
        );
        pnlHeaderLayout.setVerticalGroup(
            pnlHeaderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)
        );

        pnlLeftContent.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        pnlLeftContent.setPreferredSize(new java.awt.Dimension(200, 534));

        jtbMenu.setBorder(null);
        jtbMenu.setOrientation(1);
        jtbMenu.setRollover(true);
        jtbMenu.setEnabled(false);

        btnHome.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnHome.setForeground(new java.awt.Color(153, 51, 0));
        btnHome.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/home1.png"))); // NOI18N
        btnHome.setText("Home");
        btnHome.setFocusable(false);
        btnHome.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnHome.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnHome.setMaximumSize(new java.awt.Dimension(140, 40));
        btnHome.setMinimumSize(new java.awt.Dimension(140, 40));
        btnHome.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnHomeActionPerformed(evt);
            }
        });
        jtbMenu.add(btnHome);

        btnBranch.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnBranch.setForeground(new java.awt.Color(153, 51, 0));
        btnBranch.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/Money.png"))); // NOI18N
        btnBranch.setText("Branch Manager");
        btnBranch.setFocusable(false);
        btnBranch.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnBranch.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnBranch.setMaximumSize(new java.awt.Dimension(140, 40));
        btnBranch.setPreferredSize(new java.awt.Dimension(140, 40));
        btnBranch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBranchActionPerformed(evt);
            }
        });
        jtbMenu.add(btnBranch);

        btnLoanType.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnLoanType.setForeground(new java.awt.Color(153, 51, 0));
        btnLoanType.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/Money.png"))); // NOI18N
        btnLoanType.setText("Loan Type ");
        btnLoanType.setFocusable(false);
        btnLoanType.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnLoanType.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnLoanType.setMaximumSize(new java.awt.Dimension(140, 40));
        btnLoanType.setMinimumSize(new java.awt.Dimension(140, 40));
        btnLoanType.setPreferredSize(new java.awt.Dimension(140, 40));
        btnLoanType.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLoanTypeActionPerformed(evt);
            }
        });
        jtbMenu.add(btnLoanType);

        btnFineLoan.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnFineLoan.setForeground(new java.awt.Color(153, 51, 0));
        btnFineLoan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/Money.png"))); // NOI18N
        btnFineLoan.setText("Fine Manager");
        btnFineLoan.setFocusable(false);
        btnFineLoan.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnFineLoan.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnFineLoan.setMaximumSize(new java.awt.Dimension(140, 40));
        btnFineLoan.setPreferredSize(new java.awt.Dimension(140, 40));
        btnFineLoan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFineLoanActionPerformed(evt);
            }
        });
        jtbMenu.add(btnFineLoan);

        btnUser.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnUser.setForeground(new java.awt.Color(151, 51, 0));
        btnUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/Money.png"))); // NOI18N
        btnUser.setText("User Manager");
        btnUser.setFocusable(false);
        btnUser.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnUser.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnUser.setMaximumSize(new java.awt.Dimension(140, 40));
        btnUser.setMinimumSize(new java.awt.Dimension(140, 40));
        btnUser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUserActionPerformed(evt);
            }
        });
        jtbMenu.add(btnUser);

        btnCustomer.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnCustomer.setForeground(new java.awt.Color(151, 51, 0));
        btnCustomer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/Money.png"))); // NOI18N
        btnCustomer.setText("Customer");
        btnCustomer.setFocusable(false);
        btnCustomer.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnCustomer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnCustomer.setInheritsPopupMenu(true);
        btnCustomer.setMaximumSize(new java.awt.Dimension(140, 40));
        btnCustomer.setMinimumSize(new java.awt.Dimension(140, 40));
        btnCustomer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCustomerActionPerformed(evt);
            }
        });
        jtbMenu.add(btnCustomer);

        btnLoan.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnLoan.setForeground(new java.awt.Color(151, 51, 0));
        btnLoan.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/Money.png"))); // NOI18N
        btnLoan.setText("Loan Manager");
        btnLoan.setFocusable(false);
        btnLoan.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnLoan.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnLoan.setInheritsPopupMenu(true);
        btnLoan.setMaximumSize(new java.awt.Dimension(140, 40));
        btnLoan.setMinimumSize(new java.awt.Dimension(140, 40));
        btnLoan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLoanActionPerformed(evt);
            }
        });
        jtbMenu.add(btnLoan);

        btnReport.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnReport.setForeground(new java.awt.Color(151, 51, 0));
        btnReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/Money.png"))); // NOI18N
        btnReport.setText("Make Report");
        btnReport.setFocusable(false);
        btnReport.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnReport.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnReport.setInheritsPopupMenu(true);
        btnReport.setMaximumSize(new java.awt.Dimension(140, 40));
        btnReport.setMinimumSize(new java.awt.Dimension(140, 40));
        btnReport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnReportActionPerformed(evt);
            }
        });
        jtbMenu.add(btnReport);

        btnMyAccount.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnMyAccount.setForeground(new java.awt.Color(151, 51, 0));
        btnMyAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/Money.png"))); // NOI18N
        btnMyAccount.setText("My Account");
        btnMyAccount.setFocusable(false);
        btnMyAccount.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnMyAccount.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnMyAccount.setInheritsPopupMenu(true);
        btnMyAccount.setMaximumSize(new java.awt.Dimension(140, 40));
        btnMyAccount.setMinimumSize(new java.awt.Dimension(140, 40));
        btnMyAccount.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMyAccountActionPerformed(evt);
            }
        });
        jtbMenu.add(btnMyAccount);

        lblTime.setFont(new java.awt.Font("Tahoma", 0, 12));
        lblTime.setForeground(new java.awt.Color(151, 51, 0));

        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        btnExit.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/exit.png"))); // NOI18N
        btnExit.setText("Exit");
        btnExit.setFocusable(false);
        btnExit.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        btnExit.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnExit.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnExitActionPerformed(evt);
            }
        });
        jPanel1.add(btnExit, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 100, -1, 30));

        btnLogOut.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnLogOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/newlogout.png"))); // NOI18N
        btnLogOut.setText("Logout");
        btnLogOut.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnLogOut.setFocusable(false);
        btnLogOut.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        btnLogOut.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnLogOut.setMargin(new java.awt.Insets(2, 7, 2, 7));
        btnLogOut.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnLogOut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnLogOutActionPerformed(evt);
            }
        });
        jPanel1.add(btnLogOut, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 100, -1, 30));

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel2.setForeground(new java.awt.Color(0, 0, 153));
        jLabel2.setText("Name :");
        jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 10, -1, -1));

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel4.setForeground(new java.awt.Color(0, 0, 153));
        jLabel4.setText("Position :");
        jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 40, -1, -1));

        lblName.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblName.setForeground(new java.awt.Color(0, 0, 153));
        lblName.setText("jLabel5");
        jPanel1.add(lblName, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 10, 110, 20));

        lblPosition.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblPosition.setForeground(new java.awt.Color(0, 0, 153));
        lblPosition.setText("jLabel6");
        jPanel1.add(lblPosition, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 40, 110, 20));

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11));
        jLabel5.setForeground(new java.awt.Color(0, 0, 153));
        jLabel5.setText("Branch:");
        jPanel1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 70, -1, -1));

        lblBranch.setFont(new java.awt.Font("Tahoma", 1, 11));
        lblBranch.setForeground(new java.awt.Color(0, 0, 153));
        lblBranch.setText("jLabel6");
        jPanel1.add(lblBranch, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 70, 110, -1));

        javax.swing.GroupLayout pnlLeftContentLayout = new javax.swing.GroupLayout(pnlLeftContent);
        pnlLeftContent.setLayout(pnlLeftContentLayout);
        pnlLeftContentLayout.setHorizontalGroup(
            pnlLeftContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlLeftContentLayout.createSequentialGroup()
                .addGroup(pnlLeftContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlLeftContentLayout.createSequentialGroup()
                        .addGap(83, 83, 83)
                        .addComponent(lblTime, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE))
                    .addGroup(pnlLeftContentLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(pnlLeftContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlLeftContentLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jtbMenu, javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        pnlLeftContentLayout.setVerticalGroup(
            pnlLeftContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlLeftContentLayout.createSequentialGroup()
                .addGap(379, 379, 379)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(484, 484, 484)
                .addComponent(lblTime, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(pnlLeftContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(pnlLeftContentLayout.createSequentialGroup()
                    .addComponent(jtbMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 373, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(620, Short.MAX_VALUE)))
        );

        pnlMain.setMaximumSize(new java.awt.Dimension(850, 567));
        pnlMain.setMinimumSize(new java.awt.Dimension(850, 567));
        pnlMain.setPreferredSize(new java.awt.Dimension(850, 567));
        pnlMain.setRequestFocusEnabled(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(pnlLeftContent, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnlMain, javax.swing.GroupLayout.DEFAULT_SIZE, 852, Short.MAX_VALUE))
            .addComponent(pnlHeader, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(pnlHeader, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(pnlLeftContent, 0, 581, Short.MAX_VALUE)
                    .addComponent(pnlMain, javax.swing.GroupLayout.DEFAULT_SIZE, 581, Short.MAX_VALUE))
                .addContainerGap(26, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void btnHomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHomeActionPerformed
    callJPanel(getGuiHome(), "Welcome");
}//GEN-LAST:event_btnHomeActionPerformed

private void btnBranchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBranchActionPerformed
    callJPanel(guiBranch, "Branch Manager");
       
}//GEN-LAST:event_btnBranchActionPerformed

private void btnLoanTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoanTypeActionPerformed
      callJPanel(guiLoanType, "Loan Type Manager");
}//GEN-LAST:event_btnLoanTypeActionPerformed

private void btnFineLoanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFineLoanActionPerformed
      callJPanel(guiFineLoan, "Fine Manager");
}//GEN-LAST:event_btnFineLoanActionPerformed

private void btnUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUserActionPerformed
    // TODO add your handling code here:
    guiUser.loadBranch();
    callJPanel(guiUser,"User Manager");
}//GEN-LAST:event_btnUserActionPerformed

private void btnLoanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoanActionPerformed
// TODO add your handling code here:
    callJPanel(getGuiLoanContact(),"Loan Contact");
}//GEN-LAST:event_btnLoanActionPerformed

private void btnMyAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMyAccountActionPerformed
// TODO add your handling code here:
        callJPanel(getGuiMyInfo(),"My Information");
}//GEN-LAST:event_btnMyAccountActionPerformed

private void btnLogOutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLogOutActionPerformed
// TODO add your handling code here:
    //try {
            int choice = JOptionPane.showConfirmDialog(this, Localization.getMessage("Msg6"),"Notice",JOptionPane.YES_NO_OPTION);
            if(choice==0){
                GUILogin login = new GUILogin();
                login.setVisible(true);
                this.dispose();
            }
//        } catch (UnsupportedLookAndFeelException ex) {
//            Logger.getLogger(GUIMain.class.getName()).log(Level.SEVERE, null, ex);
//        }
}//GEN-LAST:event_btnLogOutActionPerformed

private void btnCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustomerActionPerformed
// TODO add your handling code here:
    callJPanel(getGuiCustomer(),"Customer Manager");
}//GEN-LAST:event_btnCustomerActionPerformed

private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
// TODO add your handling code here:
    int choice = JOptionPane.showConfirmDialog(null, Localization.getMessage("Msg2"), "Confirm", JOptionPane.OK_CANCEL_OPTION);
    if(choice == 0)
        System.exit(0);
}//GEN-LAST:event_btnExitActionPerformed

private void btnReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnReportActionPerformed
    // TODO add your handling code here:
    callJPanel(new GUIReport(user),"Report");
}//GEN-LAST:event_btnReportActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GUIMain().setVisible(true);
            }
        });
        }
     
     

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBranch;
    private javax.swing.JButton btnCustomer;
    private javax.swing.JButton btnExit;
    private javax.swing.JButton btnFineLoan;
    private javax.swing.JButton btnHome;
    private javax.swing.JButton btnLoan;
    private javax.swing.JButton btnLoanType;
    private javax.swing.JButton btnLogOut;
    private javax.swing.JButton btnMyAccount;
    private javax.swing.JButton btnReport;
    private javax.swing.JButton btnUser;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JToolBar jtbMenu;
    private javax.swing.JLabel lblBranch;
    private javax.swing.JLabel lblName;
    private javax.swing.JLabel lblPosition;
    private javax.swing.JLabel lblTime;
    private javax.swing.JPanel pnlHeader;
    private javax.swing.JPanel pnlLeftContent;
    private javax.swing.JTabbedPane pnlMain;
    // End of variables declaration//GEN-END:variables

    /**
     * @return the guiCustomer
     */
    public GUICustomer getGuiCustomer() {
        return guiCustomer;
    }

    /**
     * @param guiCustomer the guiCustomer to set
     */
    public void setGuiCustomer(GUICustomer guiCustomer) {
        this.guiCustomer = guiCustomer;
    }

    /**
     * @return the guiLoanContact
     */
    public GUILoanContact getGuiLoanContact() {
        return guiLoanContact;
    }

    /**
     * @param guiLoanContact the guiLoanContact to set
     */
    public void setGuiLoanContact(GUILoanContact guiLoanContact) {
        this.guiLoanContact = guiLoanContact;
    }

    /**
     * @return the guiHome
     */
    public GUIHome getGuiHome() {
        return guiHome;
    }

    /**
     * @param guiHome the guiHome to set
     */
    public void setGuiHome(GUIHome guiHome) {
        this.guiHome = guiHome;
    }

    /**
     * @return the guiMyInfo
     */
    public GUIMyInfo getGuiMyInfo() {
        return guiMyInfo;
    }

    /**
     * @param guiMyInfo the guiMyInfo to set
     */
    public void setGuiMyInfo(GUIMyInfo guiMyInfo) {
        this.guiMyInfo = guiMyInfo;
    }
}
